<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/1/4 0004
 * Time: 17:50
 */
namespace app\wap\controller;
use think\Controller;
use think\Db;

class Base  extends Controller
{
    
    



    
    
    public function _initialize(){
       /* if(request()->isMobile()){
            header("Location:http://sn.com/wap");
            die;
        }*/
        
        //        城市选择
        $cs_nav_two = Db::name('cs')->select();
        $this->assign('cs_nav_two',$cs_nav_two);
        
        //       拍摄预约
        $cs_nav_yy = Db::name('zzbj')->where('sign="mobile"')->order('id desc')->find();
        $this->assign('cs_nav_yy',$cs_nav_yy);
        
        
        
        $consult = DB::name('consult')->count();
        $this->assign('consult_num',intval($consult+10000));
        $this->assign('data_ext',getCompany());
        //风格
         $data_style = Db::name('style')->where('is_show=1 and sign="mobile" and is_del = 0')->order('sort desc,id desc')->select();
        $this->assign('data_style',$data_style);
        //基地
        $data_jd = Db::name('psjd')->where('is_show=1 and sign="mobile" and is_del = 0')->order('sort desc,id desc')->select();
        $this->assign('data_jd',$data_jd);
        //咨询配置
        $style_config=[];
        $lfsl_config=[];
        $xksl_config=[];
        $xgsl_config=[];
        $data_consult = Db::name('consult_config')->where('is_del=0 and is_show=1')->find();

        //dump($data_consult);
        if($data_consult['ps_style'] !==''){
            $style_config =explode(',',$data_consult['ps_style']);
            $this->assign('style_config',$style_config);
        }
       if($data_consult['clothes_num'] !==''){
          $lfsl_config=explode(',',$data_consult['clothes_num']);
           $this->assign('lfsl_config',$lfsl_config);


        }
        if($data_consult['xg_num'] !==''){
            $xksl_config =explode(',',$data_consult['xg_num']);
            $this->assign('xksl_config',$xksl_config);
        }

        if($data_consult['xc_num'] !==''){
            $xgsl_config =explode(',',$data_consult['xc_num']);
            $this->assign('xcsl_config',$xgsl_config);
        }

  		$data_sys = Db::name('company')->where('sign="mobile"')
            ->find();
        $this->assign('data_sys',$data_sys);

    }
    


}